import {getInitDict} from "@/api/sysDict.js";


export function getDict(proxy){
    const dictValue = {};
    const dicts = proxy.type.dicts
    let dictDataString = localStorage.getItem("dict");
    if (dictDataString !== null) {
        const dictData = JSON.parse(dictDataString);
        dicts.forEach(key => {
            if (dictData.hasOwnProperty(key)) {
                dictValue[key] = dictData[key];
            }
        });
    }
    return dictValue
}


export function initDict() {
    getInitDict().then(res => {
        localStorage.setItem("dict",JSON.stringify(res.data))
    })
}
